package com.cxyhome.mapper;

import com.cxyhome.pojo.Menu;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MenuMapper {

  @Select("SELECT * FROM menu")
  List<Menu> findAll();

  @Insert("INSERT INTO menu (menuname, menuurl) VALUES (#{menuname}, #{menuurl})")
  @Options(useGeneratedKeys = true, keyProperty = "menuid")
  Long  save(Menu menu);

  @Update("UPDATE menu SET menuname = #{menuname}, menuurl = #{menuurl} WHERE menuid = #{menuid}")
  Long  update(Menu menu);

  @Select("SELECT * FROM menu where menuid = #{id}")
  Menu findMenu(Long id);


  @Delete("DELETE FROM  menu where menuid = #{id}")
  int  deleteMenu(Long id);

}
